package com.cat.twoPointerTechnique;

/**
 * @author 曲大人的喵
 * @description https://leetcode.cn/problems/longest-uncommon-subsequence-ii/description/
 * @create 2025/8/7 15:01
 * @since JDK17
 */

public class Solution20 {
    public int findLUSlength(String[] strs) {
        int ans = 0, n = strs.length;
        for (int i = 0, j; i < n; i++) {   //
            for (j = 0; j < n; j++) {
                if (i == j) continue;
                if (judge(strs[i], strs[i].length(), strs[j], strs[j].length())) {
                    break;
                }
            }
            if (j == n) {
                ans = Math.max(ans, strs[i].length());
            }
        }
        return ans;
    }
    public boolean judge(String s1, int n, String s2, int m) {
        for (int i = 0, j = 0; i < n; i++) {
            while (j < m && s1.charAt(i) != s2.charAt(j)) {
                j++;
            }
            if (j == n) {
                return false;
            }
        }
        return true;
    }
}
